package com.gavindon.android.widget

import android.animation.ValueAnimator
import android.animation.ValueAnimator.AnimatorUpdateListener
import android.content.Context
import android.util.AttributeSet
import android.view.animation.AnticipateInterpolator
import android.widget.ImageView
import com.gavindon.android.R
import moe.codeest.enviews.ENPlayView

/**
 * description:
 * Created by liNan on  2022-2-16 17:15
 */
class CustomPlayView : androidx.appcompat.widget.AppCompatImageView {

    var STATE_PLAY = 0

    var STATE_PAUSE = 1
    private var mCurrentState = STATE_PAUSE

    constructor(context: Context?) : this(context, null)
    constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context!!,
        attrs,
        defStyleAttr
    ) {

    }

    fun play() {
        if (mCurrentState == STATE_PLAY) {
            setBackgroundResource(R.mipmap.video_icon)
            return
        }
        mCurrentState = STATE_PLAY
    }

    fun pause() {
        if (mCurrentState == STATE_PAUSE) {
            setBackgroundResource(R.mipmap.ic_launcher)
            return
        }
        mCurrentState = STATE_PAUSE
    }

    fun getCurrentState(): Int {
        return mCurrentState
    }

}